package cn.yinuo.website.common.bean;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class Page<T> implements Serializable {

    public static final int defaultCurrent = 1;
    public static final int defaultSize = 10;

    private static final long serialVersionUID = 1L;

    private Long totalPage;

    private Integer currentPage;

    private Integer size;

    private Long totalElements;
    private  List<T> list;
    public Page() {
    }



    public Page(com.baomidou.mybatisplus.plugins.Page<T> tPage) {
        this.totalElements =tPage.getTotal()==0?1:tPage.getTotal();;
        this.totalPage = tPage.getPages()==0?1:tPage.getPages();
        this.currentPage = tPage.getCurrent()==0?1:tPage.getCurrent()                     ;
        this.size = tPage.getSize();
        this.list =tPage.getRecords();
    }

}
